<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2017/12/2
  Time: 10:05
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <base href="${pageContext.request.contextPath}/">
    <title>新建销售机会</title>
    <link href="css/style.css" rel="stylesheet" type="text/css">
    <script src="js/jquery-1.9.0.js"></script>
    <script src="script/common.js"></script>
    <script>
        $(function () {
            $.get("salc/userall",function (data) {
                console.log(data);
                var chcCreateBy = $("#chcCreateBy");
                var chcDueTo = $("#chcDueTo");
                $.each(data,function (i,item) {
                    var option = '<option value='+item.usrId+","+item.usrName+'>'+item.usrName+'</option>';
                    chcCreateBy.append($(option));
                    chcDueTo.append($(option));

                });
            });

            $("#add").click(function () {
                var chcSource = $("#chcSource").val();
                var chcTel = $("#chcTel").val();
                var chcLinkman = $("#chcLinkman").val();
                var chcTitle = $("#chcTitle").val();
                var chcRate = $("#chcRate").val();

                var chcCustName = $("#chcCustName").val();
                var chcDesc = $("#chcDesc").val();
                var chc_CreateBy = $("#chcCreateBy").val();
                var chc_CreateDate = $("#chcCreateDate").val();
                var chc_DueTo = $("#chcDueTo").val();

                var chc_DueDate = $("#chcDueDate").val();


                window.location.href="salc/add?chcSource="+chcSource+
                        "&chcTel="+chcTel+"&chcLinkman="+chcLinkman+"&chcRate="+chcRate+"&chcTitle="+chcTitle+
                        "&chcCustName="+chcCustName+"&chcDesc="+chcDesc+"&chc_CreateBy="+chc_CreateBy+
                        "&chc_CreateDate="+chc_CreateDate+"&chc_DueTo="+chc_DueTo+"&chc_DueDate="+chc_DueDate;

            });
        })
    </script>
</head>
<body>
<c:if test="${not empty param.flag}">
    <c:if test="${param.flag eq '1'}">
        <script>
            alert("添加成功！");
        </script>
    </c:if>
    <c:if test="${param.flag eq '0'}">
        <script>
            alert("添加失败！");
        </script>
    </c:if>
</c:if>
<div class="page_title">销售机会管理&nbsp; &gt; 新建销售机会</div>
<div class="button_bar">
    <button class="common_button" onclick="help('');">帮助</button>
    <button class="common_button" onclick="back();">返回</button>
    <button class="common_button" id="add">保存</button>
</div>

<table class="query_form_table">
    <tr>
        <th>编号</th>
        <td><input readonly /></td>
        <th>机会来源</th>
        <td>
            <input name="T4" size="20" id="chcSource"/></td>
    </tr>
    <tr>
        <th>客户名称</th>
        <td><input  id="chcCustName"/><span class="red_star">*</span></td>
        <th>成功机率</th>
        <td><input id="chcRate"/><span class="red_star">*</span></td>
    </tr>
    <tr>
        <th>概要</th>
        <td colspan="3"><input name="T0" size="52" id="chcTitle"/><span class="red_star">*</span></td>
    </tr>
    <tr>
        <th>联系人</th>
        <td><input name="T21" size="20" id="chcLinkman"/></td>
        <th>联系人电话</th>
        <td><input name="T5" size="20" id="chcTel"/></td>
    </tr>


    <tr>
        <th>机会描述</th>
        <td colspan="3"><textarea id="chcDesc" rows="6" cols="50" name="S1"></textarea><span class="red_star">*</span></td>
    </tr>
    <tr>
        <th>创建人</th>
        <td>
            <select name="D1" id="chcCreateBy">

            </select> <span class="red_star">*</span></td>
        </td>
        <th>创建时间</th>
        <td><input id="chcCreateDate" type="date"   /><span class="red_star">*</span></td>
    </tr>
</table>
<br />
<table disabled class="query_form_table" id="table1">
    <tr>
        <th>指派给</th>
        <td>
            <select name="D1" id="chcDueTo">

            </select> <span class="red_star">*</span></td>
        <th>指派时间</th>
        <td>
            <input id="chcDueDate" type="date" /><span class="red_star">*</span></td>
    </tr>
</table>
<script>
    setCurTime('t1');
    setCurTime('t2');
</script>
</body>
</html>
